package com.party.core.model.log;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * Created by wei.li
 *
 * @date 2017/8/23 0023
 * @time 14:52
 */
public enum LogType {

    SYSTEM_LOG(0, "SYSTEM_LOG"),

    BEHAVIOR_LOG(1, "BEHAVIOR_LOG");


    //状态码
    private Integer code;

    //状态值
    private String value;

    LogType(Integer code, String value) {
        this.code = code;
        this.value = value;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static String getValue(Integer code){
        for (LogType logType : LogType.values()){
            if (logType.getCode().equals(code)){
                return logType.getValue();
            }
        }
        return null;
    }

    public static Map<Integer, String> convertMap(){
        Map<Integer, String> map = Maps.newHashMap();
        for (LogType logType : LogType.values()){
            map.put(logType.getCode(), logType.getValue());
        }
        return map;
    }
}
